<!--
 * @Author: 灰灰
 * @Date: 2021-12-30 11:47:34
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-12 11:34:17
 * @Description: Echart 相关配置
-->
<template>
  <page-box pageType="2"
            :custom="true">
    <el-row :gutter="10">
      <el-button type="primary"
                 @click="exportClick">导出图片</el-button>
      <el-button type="primary"
                 @click="exportPdfClick">导出pdf</el-button>
    </el-row>
    <div id="chartBox">
      <el-row :gutter="10">
        <line-bar :needImg="needImg"></line-bar>
      </el-row>
      <el-row :gutter="10">
        <double-yaxis :needImg="needImg"></double-yaxis>
      </el-row>
      <el-row :gutter="10">
        <pie :needImg="needImg"></pie>
      </el-row>
      <el-row>
        <table-with-chart></table-with-chart>
      </el-row>
      <el-row>
        <table-with-chart2></table-with-chart2>
      </el-row>
      <el-row>
        <long-table-with-chart></long-table-with-chart>
      </el-row>
      <el-row>
        <surplus-table-with-chart></surplus-table-with-chart>
      </el-row>
    </div>
  </page-box>
</template>

<script>
import chartMixin from '@/mixins/echartMixins/baseChartOption'
import LineBar from './components/LineBar.vue';
import DoubleYaxis from './components/DoubleYaxis.vue';
import Pie from './components/Pie.vue';
import TableWithChart from './components/TableWithChart';
import TableWithChart2 from './components/TableWithChart2';
import LongTableWithChart from './components/LongTableWithChart';
import SurplusTableWithChart from './components/SurplusTableWithChart';


import { exportImg } from "@/utils/exportFile"
export default {
  components: { LineBar, DoubleYaxis, Pie, TableWithChart, TableWithChart2, LongTableWithChart, SurplusTableWithChart },
  name: 'echart',
  mixins: [chartMixin],
  data () {
    return {
      needImg: false,
    }
  },
  mounted () {

  },
  methods: {
    exportClick () {
      this.needImg = true;
      exportImg('#chartBox', 'test', () => {
        this.needImg = false;
      });
    },
    exportPdfClick () {

    }
  }
}
</script>

<style>
</style>